package com.wenlin.myproduction.ui;

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;

import com.wenlin.myproduction.R;
import com.wenlin.myproduction.base.BaseActivity;
import com.wenlin.myproduction.base.BaseSwipeActivity;
import com.wenlin.myproduction.bean.InOutRecordsBean;
import com.wenlin.myproduction.util.ValCommon;
import com.wenlin.myproduction.widget.InOutChartView;

/**
 * @desc: 借还走势图页
 * @author: 文琳
 * @time: 2025/11/12 周三 17:58
 */
public class InOutChartActivity extends BaseSwipeActivity {
    private InOutRecordsBean records;

    public static void start(BaseActivity activity, InOutRecordsBean records) {
        Intent intent = new Intent(activity, InOutChartActivity.class);
        Bundle bundle = new Bundle();
        bundle.putSerializable(ValCommon.DATA, records);
        intent.putExtras(bundle);
        activity.startActivity(intent);
    }

    @Override
    public int getContentView() {
        return R.layout.activity_in_out_chart;
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitle("借还记录曲线图");
        Bundle bundle = getIntent().getExtras();
        if (bundle != null) {
            records= (InOutRecordsBean) bundle.getSerializable(ValCommon.DATA);
        }
        InOutChartView iocv = findViewById(R.id.iocv);
        iocv.setData(records.getList(), records.getTotalStart());
    }
}
